package com.etop.ondoc.util;

import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import com.etop.ondoc.beans.Category;

public class DefaultValue {

    /**
     * 用于分页，设定每页有15条数据
     */
    public static final int PAGE_SIZE = 10;
    public static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
    /**
     * 根分类
     */
    //public static final Category ROOT_CATEGORY = DaoFactory.getCategoryDao().loadByName("root");
    public static long hm = 86400000;//一天多少毫秒

    public static long now = System.currentTimeMillis();
    public static int hot = 8;//首页热门推荐List的大小；

    public static final int START = 0;
    public static final int SIZE = 10;
    public static String path = null;

    public static String BuiltPath(String p1, String p2, String p3) {
        if (p1 != null) {
            path = "\\" + p1;
        }
        if (p2 != null) {
            path += "\\" + p2;
        }
        if (p3 != null) {
            path += "\\" + p3;
        }
        path += "\\";
        return path;
    }

    public static Timestamp getNewTime(Date d) {

        String newtime = sdf.format(d);
        java.sql.Timestamp dateTime = null;
        try {
            java.util.Date timeDate = sdf.parse(newtime);//util类型

            dateTime = new java.sql.Timestamp(timeDate.getTime());
            //Timestamp类型,timeDate.getTime()返回一个long型

        } catch (ParseException e) {
            e.printStackTrace();
        }
        return dateTime;

    }

}
